<?php
namespace App\Traits;

use App\Models\FakeList;
use Illuminate\Http\Request;

Trait Trait48_49 {

    public function co2List()
    {
        $data = FakeList::select(['id', 'name', 'message', 'status'])->wherein('id', [77,78,79,80,81,82,83,84,85])->get();
        $responseJson = [
            'code' => 200,
            'message' => '',
            'data' => $data
        ];
        return response()->json($responseJson);
    }

    public function co2Detail(Request $request)
    {
        $validate = $request->validate(
            [
                'roomName' => 'required'
            ]
        );
        $data = FakeList::select('name', 'extra_data')->where(['name' => $validate['roomName']])->wherein('id', [77,78,79,80,81,82,83,84,85])->get();
        $responseJson = [
            'code' => 200,
            'message' => '',
            'data' => $data
        ];
        return response()->json($responseJson);
    }

}
